import Vue from 'vue'
import Vuex from 'vuex'
import * as request from '@/api'
Vue.use(Vuex)

const state = {
    tableData:[]
}
const mutations = {
    CHANGE_TABLEDATA(state,data){
        state.tableData = data
    }
}
const actions = {
    change_table_data({commit}){
        return new Promise(()=>{
            request['getData']().then((res)=>{
                commit('CHANGE_TABLEDATA',res.tableData)
            })
        })
    }
}
export default new Vuex.Store({
    state,
    mutations,
    actions
})